﻿using System;

namespace Fabrication.ValueProviders
{
    internal class FunctionValueProvider<T, TParam> : ValueProviderBase<TParam>
    {
        private readonly Func<T, TParam> valueFunction;

        public FunctionValueProvider(Func<T, TParam> valueFunction)
        {
            this.valueFunction = valueFunction;
        }

        protected override TParam GetValue(object item)
        {
            return valueFunction((T)item);
        }
    }

    internal class FunctionValueProvider<TParam> : FunctionValueProvider<object, TParam>
    {
        public FunctionValueProvider(Func<object, TParam> valueFunction)
            : base(valueFunction) { }
    }
}